﻿Public Class frmMain
    Dim frm As Form
    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim frmDialog As New frmKetNoi()
        frmDialog.ShowDialog()
        Me.Hide()
        If modKetNoi.strConnectionString = "" Then
            ' Đăng nhập ko thành công => đóng chương trình
            Me.Close()
        Else
            Me.Show()
        End If
    End Sub

    Private Sub mtsThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mtsThoat.Click
        Me.Close()
    End Sub

    Private Sub mtsTaiKhoan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mtsTaiKhoan.Click
        frm = New frmThemTaiKhoan()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub mtsKhachHang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mtsKhachHang.Click
        frm = New frmThemKhachHang()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub closeCurrentForm()
        If Not frm Is Nothing Then
            frm.Close()
        End If
    End Sub

    Private Sub mtsSetting_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mtsSetting.Click
        frm = New frmThietLap()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub DanhMụcHàngHóaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DanhMụcHàngHóaToolStripMenuItem.Click
        frm = New frmThemHangHoa()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub DanhSáchToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        frm = New frmSoCai()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub PhiếuNhậpKhoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PhiếuNhậpKhoToolStripMenuItem.Click
        frm = New frmNhapKho(-1)
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub DanhMụcĐơnVịTínhToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DanhMụcĐơnVịTínhToolStripMenuItem.Click
        frm = New frmThemDonVi()
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub PhiếuXuấtKhoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PhiếuXuấtKhoToolStripMenuItem.Click
        frm = New frmXuatKho(-1)
        frm.StartPosition = FormStartPosition.CenterScreen
        frm.Show()
    End Sub

    Private Sub NhậpSốDưĐầuKỳVTHHToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NhậpSốDưĐầuKỳVTHHToolStripMenuItem.Click
        Dim frm As New frmSoDuHH()
        frm.ShowDialog()
    End Sub

    Private Sub KếtChuyểnSốDưVậtTưHàngHóaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If aryConfig.Item("Thang") = "" Then
            MsgBox("Xin chọn kỳ hạn làm việc tại màn hình Nhập số dư đầu kỳ")
        Else
            Dim frm As New frmKetChuyen()
            frm.ShowDialog()
        End If
    End Sub

    Private Sub TổngHợpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TổngHợpToolStripMenuItem.Click
        Dim frm As New frmTongHop()
        frm.ShowDialog()
    End Sub

    Private Sub ChiTiếtToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChiTiếtToolStripMenuItem.Click
        Dim frm As New frmChiTiet()
        frm.ShowDialog()
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub PhiếuNhậpPhiếuXuấtToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PhiếuNhậpPhiếuXuấtToolStripMenuItem.Click
        Dim frm As New frmSoCai
        frm.ShowDialog()

    End Sub

    Private Sub KếtChuyểnSốDưTàiKhoảnToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KếtChuyểnSốDưTàiKhoảnToolStripMenuItem.Click

    End Sub

    Private Sub KếtChuyểnVậtTưHàngHóaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KếtChuyểnVậtTưHàngHóaToolStripMenuItem.Click
        Dim frm As New frmKetChuyen
        frm.ShowDialog()
    End Sub

    Private Sub ListboxToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListboxToolStripMenuItem.Click

    End Sub

    Private Sub HàngHóaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HàngHóaToolStripMenuItem.Click
        Dim frm As New frmHangHoa
        frm.ShowDialog()
    End Sub

    Private Sub KháchHàngToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KháchHàngToolStripMenuItem.Click
        Dim frm As New frmKhachHang
        frm.ShowDialog()
    End Sub
End Class